package framework.spring.mvc;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import entity.TestDO;

@Controller  
@RequestMapping("/test")  
public class AnnotationControllerTest2 {

	 @RequestMapping("/test.jsp")
	    public ModelAndView register() {  
	    	
	        // ��������þ����ҵ���߼�����  
	        return new ModelAndView("hello.jsp");  
	    }  
	 
	@RequestMapping(value="/{id}.htm")   
	 public ModelAndView comment(HttpServletRequest request,@PathVariable int id){  
		request.setAttribute("hello_1", "��ð�, Spring!");
		 request.setAttribute("hello_2", "Hello World!");
		 // ��������þ����ҵ���߼�����  
        return new ModelAndView("hello.jsp");  
	 }  

	  @RequestMapping("/hello.htm")  
	    public ModelAndView hello() {  
	        ArrayList<TestDO> list = new ArrayList<TestDO>();  
	        TestDO test = new TestDO();
	        test.setEmail("liuboen@denong.com");
	    	 test.setId(1l);
	    	 test.setName("liuboen");
	        list.add(test);  
	        return new ModelAndView("vtest.vm","persons",list);  
	    }  
}
